import { Component, useEffect, useState } from 'react'
import { View, Text } from '@tarojs/components'
import './index.less'
import Taro from '@tarojs/taro'

export default class Index extends Component {

  $instance = Taro.getCurrentInstance()

  componentWillMount() { }

  componentDidMount() {
    console.log(this);
    // 获取路由参数
    console.log(this.$instance.router.params.number);
   }

  componentWillUnmount() { }

  componentDidShow() { }

  componentDidHide() { }

  gotoTest = (e) => {
    Taro.navigateTo({url: "/pages/test/test?from=index"})
  }

  render() {
    return (
      <View className='index'>
        <Text onClick={this.gotoTest} title="跳转到test组件">Hello world!</Text>
        {/* <Test /> */}
      </View>
    )
  }
}

function Test(props) {
  return <Text>
    <div className="module">
      Test 组件
  </div>
  </Text>
}
